<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>修改权限</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="/oauthplatform/static/css/x-admin/font.css">
    <link rel="stylesheet" href="/oauthplatform/static/css/x-admin/xadmin.css">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form" id="dataForm">
            <input name="grade" type="text" value="${grade}" style="display:none;">
            <div class="layui-form-item">
                <label class="layui-form-label">名称</label>
                <div class="layui-input-inline">
                    <input type="text" name="name" value="${permissionInfo.name}" required  lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">必填</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">URL地址</label>
                <div class="layui-input-inline">
                    <input type="text" name="url" value="${permissionInfo.url ! ''}" required lay-verify="required" placeholder="请输入地址" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">必填</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">是否启用</label>
                <div class="layui-input-inline">
                    <select name="isValid" lay-verify="required">
                        <option value="1" <#if permissionInfo.isValid == 1>selected</#if>>是</option>
                        <option value="0" <#if permissionInfo.isValid == 0>selected</#if>>否</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">权限类型</label>
                <div class="layui-input-inline">
                    <select name="type" lay-verify="required">
                        <option value="0" <#if permissionInfo.type == 0>selected</#if>>菜单</option>
                        <option value="1" <#if permissionInfo.type == 1>selected</#if>>第三方连接</option>
                        <option value="2" <#if permissionInfo.type == 2>selected</#if>>其他</option>
                    </select>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
            <input type="hidden" value="${(permissionInfo.id?c)!}" name="id">
            <input type="hidden" value="edit" name="tag">
        </form>


    </div>
</div>
<script type="text/javascript" src="/oauthplatform/static/lib/layui/layui.all.js" charset="utf-8"></script>
<script type="text/javascript" src="/oauthplatform/static/lib/jquery/jquery.3.4.1.js"></script>
<script type="text/javascript" src="/oauthplatform/static/lib/x-admin/xadmin.js"></script>
<script src="/oauthplatform/static/lib/other/html5.min.js"></script>
<script src="/oauthplatform/static/lib/other/respond.min.js"></script>
<script>
    layui.use('form', function(){
        var form = layui.form;
        //监听提交
        form.on('submit(formDemo)', function(data){
            $.ajax({
                type: "POST",//方法类型
                url: "/oauthplatform/permission/save" ,//url
                data: $('#dataForm').serialize(),
                success: function (result) {
                    layer.msg(result.msg);
                    if(parseInt(result.code)==200){
                        setTimeout(function(){
                            xadmin.close();
                            xadmin.father_reload();
                        }, 2000);
                    }
                },
                error: function (result) {layer.msg("系统异常,请联系管理员");}
            });
            return false;
        });
    });
</script>
</html>